home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / content / nsIContentPolicy.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  11KB  |  263 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIContentPolicy.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIContentPolicy_h__
  6. #define __gen_nsIContentPolicy_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17. class nsIURI; /* forward declaration */
  18.  
  19. class nsIDOMNode; /* forward declaration */
  20.  
  21.  
  22. /* starting interface:    nsIContentPolicy */
  23. #define NS_ICONTENTPOLICY_IID_STR "3bb1a3c8-3073-41e0-9a26-a7671955fb65"
  24.  
  25. #define NS_ICONTENTPOLICY_IID \
  26.   {0x3bb1a3c8, 0x3073, 0x41e0, \
  27.     { 0x9a, 0x26, 0xa7, 0x67, 0x19, 0x55, 0xfb, 0x65 }}
  28.  
  29. /**
  30.  * Interface for content policy mechanism.  Implementations of this
  31.  * interface can be used to control loading of various types of out-of-line
  32.  * content, or processing of certain types of in-line content.
  33.  *
  34.  * WARNING: do not block the caller from shouldLoad or shouldProcess (e.g.,
  35.  * by launching a dialog to prompt the user for something).
  36.  */
  37. class NS_NO_VTABLE nsIContentPolicy : public nsISupports {
  38.  public: 
  39.  
  40.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICONTENTPOLICY_IID)
  41.  
  42.   enum { TYPE_OTHER = 1U };
  43.  
  44.   /**
  45.    * Indicates an executable script (such as JavaScript).
  46.    */
  47.   enum { TYPE_SCRIPT = 2U };
  48.  
  49.   /**
  50.    * Indicates an image (e.g., IMG elements).
  51.    */
  52.   enum { TYPE_IMAGE = 3U };
  53.  
  54.   /**
  55.    * Indicates a stylesheet (e.g., STYLE elements).
  56.    */
  57.   enum { TYPE_STYLESHEET = 4U };
  58.  
  59.   /**
  60.    * Indicates a generic object (plugin-handled content typically falls under
  61.    * this category).
  62.    */
  63.   enum { TYPE_OBJECT = 5U };
  64.  
  65.   /**
  66.    * Indicates a document at the top-level (i.e., in a browser).
  67.    */
  68.   enum { TYPE_DOCUMENT = 6U };
  69.  
  70.   /**
  71.    * Indicates a document contained within another document (e.g., IFRAMEs,
  72.    * FRAMES, and OBJECTs).
  73.    */
  74.   enum { TYPE_SUBDOCUMENT = 7U };
  75.  
  76.   /**
  77.    * Indicates a timed refresh.
  78.    *
  79.    * shouldLoad will never get this, because it does not represent content
  80.    * to be loaded (the actual load triggered by the refresh will go through
  81.    * shouldLoad as expected).
  82.    *
  83.    * shouldProcess will get this for, e.g., META Refresh elements and HTTP
  84.    * Refresh headers.
  85.    */
  86.   enum { TYPE_REFRESH = 8U };
  87.  
  88.   /**
  89.    * Returned from shouldLoad or shouldProcess if the load or process request
  90.    * is rejected based on details of the request.
  91.    */
  92.   enum { REJECT_REQUEST = -1 };
  93.  
  94.   /**
  95.    * Returned from shouldLoad or shouldProcess if the load/process is rejected
  96.    * based solely on its type (of the above flags).
  97.    *
  98.    * NOTE that it is not meant to stop future requests for this type--only the
  99.    * current request.
  100.    */
  101.   enum { REJECT_TYPE = -2 };
  102.  
  103.   /**
  104.    * Returned from shouldLoad or shouldProcess if the load/process is rejected
  105.    * based on the server it is hosted on or requested from (aContentLocation or
  106.    * aRequestOrigin), e.g., if you block an IMAGE because it is served from
  107.    * goatse.cx (even if you don't necessarily block other types from that
  108.    * server/domain).
  109.    * 
  110.    * NOTE that it is not meant to stop future requests for this server--only the
  111.    * current request.
  112.    */
  113.   enum { REJECT_SERVER = -3 };
  114.  
  115.   /**
  116.    * Returned from shouldLoad or shouldProcess if the load/process is rejected
  117.    * based on some other criteria. Mozilla callers will handle this like
  118.    * REJECT_REQUEST; third-party implementors may, for example, use this to
  119.    * direct their own callers to consult the extra parameter for additional
  120.    * details.
  121.    */
  122.   enum { REJECT_OTHER = -4 };
  123.  
  124.   /**
  125.    * Returned from shouldLoad or shouldProcess if the load or process request
  126.    * is not rejected.
  127.    */
  128.   enum { ACCEPT = 1 };
  129.  
  130.   /**
  131.    * Should the resource at this location be loaded?
  132.    * ShouldLoad will be called before loading the resource at aContentLocation
  133.    * to determine whether to start the load at all.
  134.    *
  135.    * @param aContentType      the type of content being tested. This will be one
  136.    *                          one of the TYPE_* constants.
  137.    *
  138.    * @param aContentLocation  the location of the content being checked; must
  139.    *                          not be null
  140.    *
  141.    * @param aRequestOrigin    OPTIONAL. the location of the resource that
  142.    *                          initiated this load request; can be null if
  143.    *                          inapplicable
  144.    *
  145.    * @param aContext          OPTIONAL. the nsIDOMNode or nsIDOMWindow that
  146.    *                          initiated the request, or something that can QI
  147.    *                          to one of those; can be null if inapplicable.
  148.    *
  149.    * @param aMimeTypeGuess    OPTIONAL. a guess for the requested content's
  150.    *                          MIME type, based on information available to
  151.    *                          the request initiator (e.g., an OBJECT's type
  152.    *                          attribute); does not reliably reflect the
  153.    *                          actual MIME type of the requested content
  154.    *
  155.    * @param aExtra            an OPTIONAL argument, pass-through for non-Gecko
  156.    *                          callers to pass extra data to callees.
  157.    *
  158.    * @return ACCEPT or REJECT_*
  159.    */
  160.   /* short shouldLoad (in unsigned long aContentType, in nsIURI aContentLocation, in nsIURI aRequestOrigin, in nsISupports aContext, in ACString aMimeTypeGuess, in nsISupports aExtra); */
  161.   NS_IMETHOD ShouldLoad(PRUint32 aContentType, nsIURI *aContentLocation, nsIURI *aRequestOrigin, nsISupports *aContext, const nsACString & aMimeTypeGuess, nsISupports *aExtra, PRInt16 *_retval) = 0;
  162.  
  163.   /**
  164.    * Should the resource be processed?
  165.    * ShouldProcess will be called once all the information passed to it has
  166.    * been determined about the resource, typically after part of the resource
  167.    * has been loaded.
  168.    *
  169.    * @param aContentType      the type of content being tested. This will be one
  170.    *                          one of the TYPE_* constants.
  171.    *
  172.    * @param aContentLocation  OPTIONAL; the location of the resource being
  173.    *                          requested: MAY be, e.g., a post-redirection URI
  174.    *                          for the resource.
  175.    *
  176.    * @param aRequestOrigin    OPTIONAL. the location of the resource that
  177.    *                          initiated this load request; can be null if
  178.    *                          inapplicable
  179.    *
  180.    * @param aContext          OPTIONAL. the nsIDOMNode or nsIDOMWindow that
  181.    *                          initiated the request, or something that can QI
  182.    *                          to one of those; can be null if inapplicable.
  183.    *
  184.    * @param aMimeType         the MIME type of the requested resource (e.g.,
  185.    *                          image/png), as reported by the networking library,
  186.    *                          if available (may be empty if inappropriate for
  187.    *                          the type, e.g., TYPE_REFRESH).
  188.    *
  189.    * @param aExtra            an OPTIONAL argument, pass-through for non-Gecko
  190.    *                          callers to pass extra data to callees.
  191.    *
  192.    * @return ACCEPT or REJECT_*
  193.    */
  194.   /* short shouldProcess (in unsigned long aContentType, in nsIURI aContentLocation, in nsIURI aRequestOrigin, in nsISupports aContext, in ACString aMimeType, in nsISupports aExtra); */
  195.   NS_IMETHOD ShouldProcess(PRUint32 aContentType, nsIURI *aContentLocation, nsIURI *aRequestOrigin, nsISupports *aContext, const nsACString & aMimeType, nsISupports *aExtra, PRInt16 *_retval) = 0;
  196.  
  197. };
  198.  
  199. /* Use this macro when declaring classes that implement this interface. */
  200. #define NS_DECL_NSICONTENTPOLICY \
  201.   NS_IMETHOD ShouldLoad(PRUint32 aContentType, nsIURI *aContentLocation, nsIURI *aRequestOrigin, nsISupports *aContext, const nsACString & aMimeTypeGuess, nsISupports *aExtra, PRInt16 *_retval); \
  202.   NS_IMETHOD ShouldProcess(PRUint32 aContentType, nsIURI *aContentLocation, nsIURI *aRequestOrigin, nsISupports *aContext, const nsACString & aMimeType, nsISupports *aExtra, PRInt16 *_retval); 
  203.  
  204. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  205. #define NS_FORWARD_NSICONTENTPOLICY(_to) \
  206.   NS_IMETHOD ShouldLoad(PRUint32 aContentType, nsIURI *aContentLocation, nsIURI *aRequestOrigin, nsISupports *aContext, const nsACString & aMimeTypeGuess, nsISupports *aExtra, PRInt16 *_retval) { return _to ShouldLoad(aContentType, aContentLocation, aRequestOrigin, aContext, aMimeTypeGuess, aExtra, _retval); } \
  207.   NS_IMETHOD ShouldProcess(PRUint32 aContentType, nsIURI *aContentLocation, nsIURI *aRequestOrigin, nsISupports *aContext, const nsACString & aMimeType, nsISupports *aExtra, PRInt16 *_retval) { return _to ShouldProcess(aContentType, aContentLocation, aRequestOrigin, aContext, aMimeType, aExtra, _retval); } 
  208.  
  209. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  210. #define NS_FORWARD_SAFE_NSICONTENTPOLICY(_to) \
  211.   NS_IMETHOD ShouldLoad(PRUint32 aContentType, nsIURI *aContentLocation, nsIURI *aRequestOrigin, nsISupports *aContext, const nsACString & aMimeTypeGuess, nsISupports *aExtra, PRInt16 *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->ShouldLoad(aContentType, aContentLocation, aRequestOrigin, aContext, aMimeTypeGuess, aExtra, _retval); } \
  212.   NS_IMETHOD ShouldProcess(PRUint32 aContentType, nsIURI *aContentLocation, nsIURI *aRequestOrigin, nsISupports *aContext, const nsACString & aMimeType, nsISupports *aExtra, PRInt16 *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->ShouldProcess(aContentType, aContentLocation, aRequestOrigin, aContext, aMimeType, aExtra, _retval); } 
  213.  
  214. #if 0
  215. /* Use the code below as a template for the implementation class for this interface. */
  216.  
  217. /* Header file */
  218. class nsContentPolicy : public nsIContentPolicy
  219. {
  220. public:
  221.   NS_DECL_ISUPPORTS
  222.   NS_DECL_NSICONTENTPOLICY
  223.  
  224.   nsContentPolicy();
  225.  
  226. private:
  227.   ~nsContentPolicy();
  228.  
  229. protected:
  230.   /* additional members */
  231. };
  232.  
  233. /* Implementation file */
  234. NS_IMPL_ISUPPORTS1(nsContentPolicy, nsIContentPolicy)
  235.  
  236. nsContentPolicy::nsContentPolicy()
  237. {
  238.   /* member initializers and constructor code */
  239. }
  240.  
  241. nsContentPolicy::~nsContentPolicy()
  242. {
  243.   /* destructor code */
  244. }
  245.  
  246. /* short shouldLoad (in unsigned long aContentType, in nsIURI aContentLocation, in nsIURI aRequestOrigin, in nsISupports aContext, in ACString aMimeTypeGuess, in nsISupports aExtra); */
  247. NS_IMETHODIMP nsContentPolicy::ShouldLoad(PRUint32 aContentType, nsIURI *aContentLocation, nsIURI *aRequestOrigin, nsISupports *aContext, const nsACString & aMimeTypeGuess, nsISupports *aExtra, PRInt16 *_retval)
  248. {
  249.     return NS_ERROR_NOT_IMPLEMENTED;
  250. }
  251.  
  252. /* short shouldProcess (in unsigned long aContentType, in nsIURI aContentLocation, in nsIURI aRequestOrigin, in nsISupports aContext, in ACString aMimeType, in nsISupports aExtra); */
  253. NS_IMETHODIMP nsContentPolicy::ShouldProcess(PRUint32 aContentType, nsIURI *aContentLocation, nsIURI *aRequestOrigin, nsISupports *aContext, const nsACString & aMimeType, nsISupports *aExtra, PRInt16 *_retval)
  254. {
  255.     return NS_ERROR_NOT_IMPLEMENTED;
  256. }
  257.  
  258. /* End of implementation class template. */
  259. #endif
  260.  
  261.  
  262. #endif /* __gen_nsIContentPolicy_h__ */
  263.